#include "struct_pack.hpp"

#include <iostream>
#include <string>

struct person {
    int id;
    std::string name;
    int age;
    double salary;
};

using namespace struct_pack;

int main() {
    person person1{.id = 1, .name = "zhangsan", .age = 20, .salary = 1024.42};

    // one line code serialize
    auto buffer = serialize<std::string>(person1);
    std::cout << "buffer length: " << buffer.length() << '\n';

    // one line code deserialization
    auto person2 = deserialize<person>(buffer);
    std::cout << "name: " << person2.value().name << '\n';
}
